{{define "base"}}
<!doctype html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<title>{{template "title" .}} - Snippetbox</title>
<!-- Link to the CSS stylesheet and favicon -->
<link rel='stylesheet' href='/static/css/main.css'>
<link rel='shortcut icon' href='/static/img/favicon.ico' type='image/x-icon'>

</head>
<body>
    <header>
    <h1><a href='/'>Snippetbox</a></h1>
    </header>
    <nav>
    <div>
    <a href='/'>Home</a>
    {{if .IsAuthenticated}}
    <a href='/snippet/create'>Create snippet</a>
    {{end}}
    </div>
    <div>
    {{if .IsAuthenticated}}
    <form action='/user/logout' method='POST'>
    <!-- Include the CSRF token -->
    <input type='hidden' name='csrf_token' value='{{.CSRFToken}}'>
    <button>Logout</button>
    </form>
    {{else}}
    <a href='/user/signup'>Signup</a>
    <a href='/user/login'>Login</a>
    {{end}}
    </div>
    </nav>
    <main>
    {{with .Flash}}
    <div class='flash '>{{.}}</div>
    {{end}}
    {{template "main" .}}
    </main>
    {{template "footer" .}}
    <script src="/static/js/main.js" type="text/javascript"></script>
    </body>
    </html>
    {{end}}